<?php
/**
 * Created by PhpStorm.
 * User: lizx
 * Date: 2018/1/30
 * Time: 10:47
 */

namespace app\common\Server;

use app\common\Service;

class Sms extends Service
{
    /**
     * 发送短信
     * @param phone 手机号码
     * @param code  验证码
     * @param type  发送方式
     */
    public function sendCaptch($phone, $code, $type = 0)
    {
        //短信接口
        $res = \Zhutong\SMS::sendCaptcha($phone, $code, $type);
        if ($res[0] != 1) {
//            $error = isset($res[1]) ?$res[1]:'';
//            if (!empty($error))
//            {
//                return [\EC::UNKNOWN, 'errData' => ['msg' => $error]];
//            }
//            return [\EC::UNKNOWN, 'errData' => ['code' => \EC::PHONE_FAILURE]];
            return false;
        }
        return true;
//        return [\EC::SUCCESS];
    }
}